//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include "Node.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T>::TNode (): info(NULL), 
                     hidden(false), 
                     previous(NULL), 
                     next(NULL) {}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T>::TNode (T info) : hidden (false) {
  
  this->info      = new T (info);
  this->previous  = NULL;
  this->next      = NULL;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T>::TNode (T* info) : hidden (false) {
  
  this->info      = info;
  this->previous  = NULL;
  this->next      = NULL;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T>::~TNode () {
  
  if (this->info) delete this->info;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
T* TNode <T>::Info (void) {
  
  return this->info;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::Info (T* info) {
  
  if (info && this->info) delete this->info;
  this->info = info;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::Info (T info) {
  
  if (this->info) delete this->info;
  this->info = new T;
  *(this->info) = info;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::SetHidden (void) {
  
  this->hidden = true;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::SetVisible (void) {
  
  this->hidden = false;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
bool TNode <T>::IsHidden (void) {
  
  return (this->hidden == true);
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
bool TNode <T>::IsVisible (void) {
  
  return (this->hidden == false);
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T>* TNode <T>::Next (void) {

  return this->next;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::Next (TNode <T>* next) {
  
  this->next = next;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::Next (const TNode <T>& next) {
  
  this->next = &next;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T>* TNode <T>::Previous (void) {
  
  return this->previous;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::Previous (TNode <T>* previous) {
  
  this->previous = previous;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
void TNode <T>::Previous (const TNode <T>& previous) {
  
  this->previous = &previous;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
template <class T>
TNode <T> TNode<T>::operator= (const TNode <T>& node) {
  
  if (this->info) delete this->info;
  this->info     = node.info;
  this->hidden   = node.hidden;
  this->next     = node.next;
  this->previous = node.previous;
  
  return *this;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
